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IGNoYXIgKmZuYW1lOworICAgIAorICAgIC8qIFdlIG5lZWQgdG8gc3VwcHJlc3MgdGhlICIgY2hhciBhcm91bmQgdGhlIG5hbWUgICAgICAgICAgICAgICAgICAgICAgICAqLworICAgIGlmIChuYW1lIFswXSA9PSAnIicpIHsKKyAgICAgICAgbmFtZSArKzsKKyAgICB9CisgICAgbGcgPSBzdHJsZW4gKG5hbWUpOworICAgIGlmIChuYW1lIFtsZyAtIDFdID09ICciJykgeworICAgICAgICBuYW1lIFtsZyAtIDFdID0gJ1wwJzsKKyAgICB9CisKKyAgICAvKiBPcGVuIGZpbGUgc3lzdGVtICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKyAgICBpZiAoZnNfaW5pdCAoJmZzKSA8IDApIHsKKyAgICAgICAgcmV0dXJuIC0xOworICAgIH0KKworICAgIC8qIEluaXQgdGhlIGZpbGUgZGVzY3JpcHRvciAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworICAgIGZpbGUubmFtZSA9IG5hbWU7CisgICAgZmlsZS5mcyA9ICZmczsKKyAgICAKKyAgICAvKiBmaW5kIHRoZSBzdWJkaXJlY3RvcnkgY29udGFpbmluZyB0aGUgZmlsZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKyAgICBpZiAob3Blbl9zdWJkaXIgKCZmaWxlKSA8IDApIHsKKyAgICAgICAgcmV0dXJuICgtMSk7CisgICAgfQorCisgICAgZm5hbWUgPSBiYXNlbmFtZSAobmFtZSk7CisKKyAgICAvKiBpZiB3ZSB0cnkgdG8gb3BlbiByb290IGRpcmVjdG9yeSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKyAgICBpZiAoKmZuYW1lID09ICdcMCcpIHsKKyAgICAgICAgZmlsZS5maWxlID0gZmlsZS5zdWJkaXI7CisgICAgICAgIHJldHVybiAoMCk7CisgICAgfQorICAgIAorICAgIC8qIGZpbmQgdGhlIGZpbGUgaW4gdGhlIHN1YmRpciAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworICAgIGVudHJ5ID0gMDsKKyAgICBpZiAodmZhdF9sb29rdXAgKCZmaWxlLnN1YmRpciwKKyAgICAgICAgICAgICAgICAgICAgIGZpbGUuZnMsCisgICAgICAgICAgICAgICAgICAgICAmZmlsZS5maWxlLmRpciwKKyAgICAgICAgICAgICAgICAgICAgICZlbnRyeSwKKyAgICAgICAgICAgICAgICAgICAgIDAsCisgICAgICAgICAgICAgICAgICAgICBmbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgIEFDQ0VQVF9ESVIgfCBBQ0NFUFRfUExBSU4gfCBTSU5HTEUgfCBET19PUEVOLAorICAgICAgICAgICAgICAgICAgICAgMCwKKyAgICAgICAgICAgICAgICAgICAgICZmaWxlLmZpbGUpICE9IDApIHsKKyAgICAgICAgLyogRmlsZSBub3QgZm91bmQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKyAgICAgICAgcHJpbnRmICgiRmlsZSBub3QgZm91bmRcbiIpOworICAgICAgICByZXR1cm4gKC0xKTsKKyAgICB9CisKKyAgICByZXR1cm4gMDsKK30KKworLyotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQorICogZG9zX3JlYWQgLS0gCisgKi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tCisgKi8KK2ludCBkb3NfcmVhZCAodWxvbmcgYWRkcikKK3sKKyAgICBpbnQgcmVhZCA9IDAsIG5iOworCisgICAgLyogVHJ5IHRvIGJvb3QgYSBkaXJlY3RvcnkgPyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisgICAgaWYgKGZpbGUuZmlsZS5kaXIuYXR0ciAmIChBVFRSX0RJUkVDVE9SWSB8IEFUVFJfVk9MVU1FKSkgeworICAgICAgICBwcmludGYgKCJVbmFibGUgdG8gYm9vdCAlcyAhIVxuIiwgZmlsZS5uYW1lKTsKKyAgICAgICAgcmV0dXJuICgtMSk7CisgICAgfQorICAgIHdoaWxlIChyZWFkIDwgZmlsZS5maWxlLkZpbGVTaXplKSB7CisgICAgICAgIFBSSU5URiAoInJlYWRfZmlsZSAoJWxkKVxuIiwgKGZpbGUuZmlsZS5GaWxlU2l6ZSAtIHJlYWQpKTsKKyAgICAgICAgbmIgPSByZWFkX2ZpbGUgKCZmcywKKyAgICAgICAgICAgICAgICAgICAgICAgICZmaWxlLmZpbGUsCisgICAgICAgICAgICAgICAgICAgICAgICAoY2hhciAqKWFkZHIgKyByZWFkLAorICAgICAgICAgICAgICAgICAgICAgICAgcmVhZCwKKyAgICAgICAgICAgICAgICAgICAgICAgIChmaWxlLmZpbGUuRmlsZVNpemUgLSByZWFkKSk7CisgICAgICAgIFBSSU5URiAoInJlYWRfZmlsZSAtPiAlZFxuIiwgbmIpOworICAgICAgICBpZiAobmIgPCAwKSB7CisgICAgICAgICAgICBwcmludGYgKCJyZWFkIGVycm9yXG4iKTsKKyAgICAgICAgICAgIHJldHVybiAoLTEpOworICAgICAgICB9CisgICAgICAgIHJlYWQgKz0gbmI7CisgICAgfQorICAgIHJldHVybiAocmVhZCk7Cit9CisvKi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tCisgKiBkb3NfZGlyIC0tIAorICotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQorICovCitpbnQgZG9zX2RpciAodm9pZCkKK3sKKyAgICBpbnQgZW50cnk7CisgICAgRGlyZWN0b3J5X3QgZGlyOworICAgIGNoYXIgKm5hbWU7CisgICAgCisgICAgCisgICAgaWYgKChmaWxlLmZpbGUuZGlyLmF0dHIgJiBBVFRSX0RJUkVDVE9SWSkgPT0gMCkgeworICAgICAgICBwcmludGYgKCIlczogbm90IGEgZGlyZWN0b3J5ICEhXG4iLCBmaWxlLm5hbWUpOworICAgICAgICByZXR1cm4gKDEpOworICAgIH0KKyAgICBlbnRyeSA9IDA7CisgICAgaWYgKChuYW1lID0gbWFsbG9jIChNQVhfVk5BTUVMRU4gKyAxKSkgPT0gTlVMTCkgeworICAgICAgICBQUklOVEYgKCJBbGxjYXRpb24gZXJyb3JcbiIpOworICAgICAgICByZXR1cm4gKDEpOworICAgIH0KKyAgICAKKyAgICB3aGlsZSAodmZhdF9sb29rdXAgKCZmaWxlLmZpbGUsCisgICAgICAgICAgICAgICAgICAgICAgICBmaWxlLmZzLAorICAgICAgICAgICAgICAgICAgICAgICAgJmRpciwKKyAgICAgICAgICAgICAgICAgICAgICAgICZlbnRyeSwKKyAgICAgICAgICAgICAgICAgICAgICAgIDAsCisgICAgICAgICAgICAgICAgICAgICAgICBOVUxMLAorICAgICAgICAgICAgICAgICAgICAgICAgQUNDRVBUX0RJUiB8IEFDQ0VQVF9QTEFJTiB8IE1BVENIX0FOWSwKKyAgICAgICAgICAgICAgICAgICAgICAgIG5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICBOVUxMKSA9PSAwKSB7CisgICAgICAgIC8qIERpc3BsYXkgZmlsZSBpbmZvICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisgICAgICAgIHByaW50ZiAoIiUzLjNzICU5ZCAlcyAlMDJkICUwNGQgJTAyZDolMDJkOiUwMmQgJXNcbiIsCisgICAgICAgICAgICAgICAgKGRpci5hdHRyICYgQVRUUl9ESVJFQ1RPUlkpID8gImRpciIgOiAiICAgIiwKKyAgICAgICAgICAgICAgICBfX2xlMzJfdG9fY3B1IChkaXIuc2l6ZSksCisgICAgICAgICAgICAgICAgbW9udGggW0RPU19NT05USCAoJmRpcikgLSAxXSwKKyAgICAgICAgICAgICAgICBET1NfREFZICgmZGlyKSwKKyAgICAgICAgICAgICAgICBET1NfWUVBUiAoJmRpciksCisgICAgICAgICAgICAgICAgRE9TX0hPVVIgKCZkaXIpLAorICAgICAgICAgICAgICAgIERPU19NSU5VVEUgKCZkaXIpLAorICAgICAgICAgICAgICAgIERPU19TRUMgKCZkaXIpLAorICAgICAgICAgICAgICAgIG5hbWUpOworICAgICAgICAKKyAgICB9CisgICAgZnJlZSAobmFtZSk7CisgICAgcmV0dXJuICgwKTsKK30KKworI2VuZGlmCg==